package com.chatplus.application.domain.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;

@JsonIgnoreProperties(ignoreUnknown = true)
public class ChatConfigDto implements Serializable {

    /**
     * azure : {"api_url":"https://chat-bot-api.openai.azure.com/openai/deployments/{dto}/chat/completions?api-version=2023-05-15","max_tokens":1024,"temperature":1}
     * baidu : {"api_url":"https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/{dto}","max_tokens":1024,"temperature":0.95}
     * chat_gml : {"api_url":"https://open.bigmodel.cn/api/paas/v3/model-api/{dto}/sse-invoke","max_tokens":1024,"temperature":0.95}
     * context_deep : 4
     * dall_api_url : https://api.openai.com/v1/images/generations
     * dall_img_num : 1
     * enable_context : true
     * enable_history : true
     * open_ai : {"api_url":"https://api.chatanywhere.org/v1/chat/completions","max_tokens":1024,"temperature":1}
     * xun_fei : {"api_url":"wss://spark-api.xf-yun.com/{version}/chat","max_tokens":1024,"temperature":0.5}
     */

    @JsonProperty("azure")
    private AzureBean azure;
    @JsonProperty("baidu")
    private BaiduBean baidu;
    @JsonProperty("chat_gml")
    private ChatGmlBean chatGml;
    @JsonProperty("context_deep")
    private Long contextDeep;
    @JsonProperty("dall_api_url")
    private String dallApiUrl;
    @JsonProperty("dall_img_num")
    private Long dallImgNum;
    @JsonProperty("enable_context")
    private boolean enableContext;
    @JsonProperty("enable_history")
    private boolean enableHistory;
    @JsonProperty("open_ai")
    private OpenAiBean openAi;
    @JsonProperty("xun_fei")
    private XunFeiBean xunFei;

    public AzureBean getAzure() {
        return azure;
    }

    public void setAzure(AzureBean azure) {
        this.azure = azure;
    }

    public BaiduBean getBaidu() {
        return baidu;
    }

    public void setBaidu(BaiduBean baidu) {
        this.baidu = baidu;
    }

    public ChatGmlBean getChatGml() {
        return chatGml;
    }

    public void setChatGml(ChatGmlBean chatGml) {
        this.chatGml = chatGml;
    }

    public Long getContextDeep() {
        return contextDeep;
    }

    public void setContextDeep(Long contextDeep) {
        this.contextDeep = contextDeep;
    }

    public String getDallApiUrl() {
        return dallApiUrl;
    }

    public void setDallApiUrl(String dallApiUrl) {
        this.dallApiUrl = dallApiUrl;
    }

    public Long getDallImgNum() {
        return dallImgNum;
    }

    public void setDallImgNum(Long dallImgNum) {
        this.dallImgNum = dallImgNum;
    }

    public boolean isEnableContext() {
        return enableContext;
    }

    public void setEnableContext(boolean enableContext) {
        this.enableContext = enableContext;
    }

    public boolean isEnableHistory() {
        return enableHistory;
    }

    public void setEnableHistory(boolean enableHistory) {
        this.enableHistory = enableHistory;
    }

    public OpenAiBean getOpenAi() {
        return openAi;
    }

    public void setOpenAi(OpenAiBean openAi) {
        this.openAi = openAi;
    }

    public XunFeiBean getXunFei() {
        return xunFei;
    }

    public void setXunFei(XunFeiBean xunFei) {
        this.xunFei = xunFei;
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class AzureBean extends CommonSettingBean{
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class BaiduBean extends CommonSettingBean{
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class ChatGmlBean  extends CommonSettingBean{
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class OpenAiBean extends CommonSettingBean{
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class XunFeiBean  extends CommonSettingBean{
    }
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class CommonSettingBean implements Serializable{
        @JsonProperty("max_tokens")
        private Integer maxTokens;
        @JsonProperty("temperature")
        private float temperature;
        public Integer getMaxTokens() {
            return maxTokens;
        }

        public void setMaxTokens(Integer maxTokens) {
            this.maxTokens = maxTokens;
        }

        public float getTemperature() {
            return temperature;
        }

        public void setTemperature(float temperature) {
            this.temperature = temperature;
        }
    }
}
